namespace mecs {
    export class FrameUtil {

        /** 当前逻辑帧是否是关键帧 */
        static logicFrameIsKeyFrame(localFrameId: number, localFrameDelay: number, serverFrameDelay: number) {
            let dt = (localFrameDelay * localFrameId) % serverFrameDelay
            return dt >= 0 && dt < localFrameDelay;
        }

        /** 服务器的数据帧转换为本地关键逻辑帧是第几帧 */
        static s2cKeyFrame(sfid: number, localFrameDelay: number, serverFrameDelay: number) {
            let keyId = Math.round(sfid * serverFrameDelay / localFrameDelay);
            return keyId;
        }

    }
}